<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.controller');

class ArticleflowControllerHistory extends JController {

    function __construct($config = array()) {
        parent::__construct($config);

        $this->registerTask('add', 'display');
        $this->registerTask('edit', 'display');
    }

    function display($cachable = false) {

        switch ($this->getTask()) {
            case 'add': {
                    JRequest::setVar('hidemainmenu', 1);
                    JRequest::setVar('layout', 'form');
                    JRequest::setVar('view', 'history_edit');
                    JRequest::setVar('edit', false);
                }break;
            case 'edit': {
              
                    JRequest::setVar('hidemainmenu', 1);
                    JRequest::setVar('layout', 'form');
                    JRequest::setVar('view', 'history_edit');
                    JRequest::setVar('edit', true);
                    
                }
                break;

            default : {
                    JRequest::setVar('view', 'history'); 
                }break;
        }
        parent::display($cachable);
    }
    function Previous()
    {
        $post = JRequest::get('post');
         $cid = JRequest::getVar('cid', array(0), 'post', 'array');
         $post['id'] = (int) $cid[0];
         $this->setRedirect('index.php?option=com_articleflow&task=edit&cid[]='. $post['id']);
    }
    function cancel()
    {
        $post = JRequest::get('post');
         $cid = JRequest::getVar('cid', array(0), 'post', 'array');
         $post = (int) $cid[0];
        // echo 'test ' . $post['id'];
         $this->setRedirect('index.php?option=com_articleflow&view=history&cid='. $post);
    }
}

?>
